"""
应用配置
"""
import os
from typing import Optional


class Settings:
    """应用配置类"""
    
    # API配置
    APP_NAME: str = "报关单字段提取API"
    APP_VERSION: str = "1.0.0"
    API_HOST: str = "0.0.0.0"
    API_PORT: int = 8000
    
    # 外部API配置
    BASE_URL: str = "https://uat.agentspro.cn"
    UPLOAD_URL: str = f"{BASE_URL}/openapi/fs/upload"
    CHAT_URL: str = f"{BASE_URL}/openapi/agents/chat/completions/v1"
    
    # 认证配置
    AUTH_KEY: str = "02d121e8db8d42f39b7a26d0843e4c12"
    AUTH_SECRET: str = "HgdrT9qnyk1k584xpT0hhseGg3Q7u9at"
    AUTH_TOKEN: str = f"Bearer {AUTH_KEY}.{AUTH_SECRET}"
    
    # 智能体配置
    PARSE_AGENT_ID: str = "594a423a41c848aa9f509787c0401499"  # 文件解析智能体
    EXTRACT_AGENT_ID: str = "8aba0a1e3cd14c2fa4fbc47158eeea64"  # 字段提取智能体
    USER_CHAT_INPUT: str = ""
    
    # 并发配置
    MAX_CONCURRENT_REQUESTS: int = 5  # 最大并发数
    REQUEST_TIMEOUT: int = 3000  # 请求超时时间（秒）
    
    # 输出配置
    OUTPUT_DIR: str = "output"
    
    # 日志配置
    LOG_LEVEL: str = "INFO"
    LOG_FORMAT: str = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    
    def __init__(self):
        """初始化配置，创建必要的目录"""
        os.makedirs(self.OUTPUT_DIR, exist_ok=True)


# 创建全局配置实例
settings = Settings()

